<template>
    <div>
        <h1>权益新增</h1>
        <table class="table">
            <tbody>
                <tr>
                    <td>权益名称</td>
                    <td>
                        <input type="text" v-model="date.rightLevelName">
                    </td>
                </tr>
                <tr>
                    <td>权益状态</td>
                    <td>
                        <input type="checkbox" v-model="date.rstate">勾选为true,否则false
                    </td>
                </tr>
                <tr>
                    <td>是否删除</td>
                    <td>
                        <input type="checkbox" v-model="date.isDelete">勾选为true,否则false
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2">
                        <input type="button" value="新增" @click="addright">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import axios from 'axios';
const routher = useRouter()
const addright=()=>{
    axios.post("https://localhost:7258/api/RightLevel/AddRight",date.value).then(res=>{
        if(res.data>0){
            alert("新增成功")
            routher.push({path:"/ShowRight"})
        }
        else{
            alert("新增失败")
        }
    })
}
const date=ref({
  "rightLevelId": 0,
  "rightLevelName": "",
  "rstate": false,
  "isDelete": false
})
</script>

<style scoped>

</style>